Package com.fsf.news.service
Class NewsServiceTest
java.lang.Object
com.fsf.news.service.NewsServiceTest
Unit tests for the NewsService class.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) com.fsf.news.client.NewsApiClient(package private) com.fsf.news.processor.NewsFleschMetricsProcessor(package private) com.fsf.news.model.form.NewsForm(package private) play.twirl.api.Html(package private) com.fasterxml.jackson.databind.JsonNode(package private) com.fsf.news.renderer.NewsRenderer(package private) com.fsf.news.repository.NewsRepository(package private) com.fsf.news.processor.NewsResponseProcessor(package private) com.fsf.news.processor.NewsSentimentProcessor(package private) com.fsf.news.service.NewsService(package private) com.fsf.news.processor.NewsWordStatsProcessor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidTests that the addSearchResult method adds a search result and returns the expected result.(package private) voidTests that the addSearchResult method throws an exception when no session ID is provided.(package private) voidTests that the getSearchResults method returns the expected results.(package private) voidTests that the getSearchResults method throws an exception when no session ID is provided.(package private) voidTests that the getSearchResultWordStats method returns the expected word statistics for a given search result.(package private) voidTests that the getSearchResultWordStats method throws an exception when no search result is found.(package private) voidTests that the getSearchResultWordStats method throws an exception when no session ID is provided.
-
Field Details
-
service
@InjectMocks com.fsf.news.service.NewsService service -
apiClient
@Mock com.fsf.news.client.NewsApiClient apiClient -
responseProcessor
@Mock com.fsf.news.processor.NewsResponseProcessor responseProcessor -
wordStatsProcessor
@Mock com.fsf.news.processor.NewsWordStatsProcessor wordStatsProcessor -
fleschMetricsProcessor
@Mock com.fsf.news.processor.NewsFleschMetricsProcessor fleschMetricsProcessor -
sentimentProcessor
@Mock com.fsf.news.processor.NewsSentimentProcessor sentimentProcessor -
renderer
@Mock com.fsf.news.renderer.NewsRenderer renderer -
repository
@Mock com.fsf.news.repository.NewsRepository repository -
form
@Mock com.fsf.news.model.form.NewsForm form -
jsonNode
@Mock com.fasterxml.jackson.databind.JsonNode jsonNode -
html
@Mock play.twirl.api.Html html
-
-
Constructor Details
-
NewsServiceTest
NewsServiceTest()
-
-
Method Details
-
testGetSearchResults
@Test void testGetSearchResults()Tests that the getSearchResults method returns the expected results. -
testGetSearchResultsException
@Test void testGetSearchResultsException()Tests that the getSearchResults method throws an exception when no session ID is provided. -
testAddSearchResult
@Test void testAddSearchResult()Tests that the addSearchResult method adds a search result and returns the expected result. -
testAddSearchResultException
@Test void testAddSearchResultException()Tests that the addSearchResult method throws an exception when no session ID is provided. -
testGetSearchResultWordStats
@Test void testGetSearchResultWordStats()Tests that the getSearchResultWordStats method returns the expected word statistics for a given search result. -
testGetSearchResultWordStatsException
@Test void testGetSearchResultWordStatsException()Tests that the getSearchResultWordStats method throws an exception when no session ID is provided. -
testGetSearchResultWordStatsEmpty
@Test void testGetSearchResultWordStatsEmpty()Tests that the getSearchResultWordStats method throws an exception when no search result is found.
-